<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h1>hello</h1>

    <img src="" alt="">

    <script>

        var oH1 = document.querySelector('h1');
        console.log(oH1);

        oH1.style.color = 'red'    // ok的    oH1 是标签对象

        // oH1.id = 'a';

        // oH1.className = 'b';

        oH1.setAttribute('id', 'a');


        var oImg = document.querySelector('img');
        oImg.alt = '888'


        // console.log('<h1>hello</h1>');

        var a = '<h1>hello</h1>';
        // a.style.color = 'blue'    // 报错的    a是字符串  字符串并没有style

    </script>

</body>

</html>